# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-pyroute2
_pkgname=pyroute2
pkgver=0.5.7
pkgrel=3
pkgdesc='Python Netlink library.'
url='https://pypi.org/project/pyroute2/#files'
arch=('any')
license=('Apache' 'GPL2')
depends=('python2')
makedepends=('python2-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('6f948eb99a96ad57de7612565da0eb1e14fb59a1defc88e2bac930d77ae5efcff7268a0109cf608cbd2c6afc81d99aab18ad3b4257731946ee6ba9608cd5ac00')

build() {
  cd "$_pkgname-$pkgver"

  python2 setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  for i in "$pkgdir/usr/bin/"*; do
    mv $i "${i}2"
  done
}

